const fs = require('fs');

function fromJSONFile(filename) {
    return (req, res) => {
        const data = fs.readFileSync(`mock/data/${filename}.json`).toString();
        const json = JSON.parse(data);
        return res.json(json);
    };
}
const proxy = {
    'GET /app/user/profile': fromJSONFile('profile'),
    'GET /app/stock': fromJSONFile('stock'),
    'GET /app/category': fromJSONFile('category')
};
module.exports = proxy;